<template>
  <div class="registerDetail">
    <van-nav-bar :title="$route.meta.title" left-text="返回" left-arrow :right-text="dataSource.billStatus == '保存'?'编辑':''" @click-right="editApply(dataSource.billStatus)" :fixed="true" :placeholder="true" @click-left="$router.go(-1)" />
    <div>
      <van-field readonly v-model="dataSource.billNumber" name="单据编号" label="单据编号" input-align="right" />
      <van-field readonly v-model="dataSource.billStatus" name="单据状态" label="单据状态" input-align="right" />
      <van-field readonly v-model="dataSource.vinCode" name="车架号" label="车架号" input-align="right" />
      <van-field readonly v-model="dataSource.contNo" name="采购合同" label="采购合同" input-align="right" />
      <van-field readonly v-model="dataSource.saleContNo" name="销售合同" label="销售合同" input-align="right" />
      <van-field readonly v-model="dataSource.vehicleSaleDate" name="车辆销售日期" label="车辆销售日期" input-align="right" />
      <van-field readonly v-model="dataSource.procurementCost" name="采购成本" label="采购成本" input-align="right" />
      <van-field readonly v-model="dataSource.salePrice" name="车辆售价" label="车辆售价" input-align="right" />
      <van-field readonly v-model="dataSource.proviceName" name="信息提供人" label="信息提供人" input-align="right" />
      <van-field readonly v-model="dataSource.assessName" name="评估人员" label="评估人员" input-align="right" />
      <van-field readonly v-model="dataSource.capInterest" name="资金利息" label="资金利息" input-align="right" />
      <van-field readonly v-model="dataSource.costTotal" name="整备费用合计" label="整备费用合计" input-align="right" />
      <div class="tableData">
        <table>
          <tr>
            <th>版本整备</th>
            <th>机电修复</th>
            <th>其他整备费用</th>
            <th>检测费用</th>
            <th>认证延保</th>
            <th>精洗美容</th>
            <th>整备工单费用</th>
          </tr>

          <tr>
            <td>{{ dataSource.costSheetSparay }}</td>
            <td>{{ dataSource.costEMRepair }}</td>
            <td>{{ dataSource.costOther }}</td>
            <td>{{ dataSource.costInspection }}</td>
            <td>{{ dataSource.costCerExtension }}</td>
            <td>{{ dataSource.costClean }}</td>
            <td>{{ dataSource.costPrepareAmt }}</td>
          </tr>
        </table>
      </div>
      <van-field readonly v-model="dataSource.otherTotal" name="其他杂费合计" label="其他杂费合计" input-align="right" />
      <div class="tableData">
        <table>
          <tr>
            <th>佣金</th>
            <th>税费</th>
            <th>差旅费</th>
            <th>过户费</th>
            <th>加油费</th>
            <th>板车费</th>
          </tr>

          <tr>
            <td>{{ dataSource.otherCommission }}</td>
            <td>{{ dataSource.otherTax }}</td>
            <td>{{ dataSource.otherTracel }}</td>
            <td>{{ dataSource.otherTransfer }}</td>
            <td>{{ dataSource.otherOil }}</td>
            <td>{{ dataSource.otherBoardCar }}</td>
          </tr>
        </table>
      </div>
      <!-- <div class="footerBtn">
        <div class="submitBtn flex">
          <div class="btnbox editBtn" @click="editApply">编辑</div>
        </div>
      </div>-->
    </div>
  </div>
</template>

<script>
import {
  Search,
  Empty,
  Field,
  Form,
  Uploader,
  DatetimePicker,
  Tab,
  Tabs,
  ImagePreview,
  ShareSheet,
  Dialog
} from "vant";
import { getCookies } from "@/utils/util.js";

import sellManageApi from "@/api/sellManageApi";

export default {
  name: "taskCenterDetail",
  components: {
    Search,
    Empty,
    Field,
    Form,
    Uploader,
    DatetimePicker,
    Tab,
    Tabs,
    ImagePreview,
    ShareSheet,
    Dialog
  },
  data() {
    return {
      showTimerPicker: false,
      dataSource: {
        billId: "", //单据Id
        billNumber: "", //出库单编号
        vehicleSaleDate: "", //车辆销售日期
        billStatus: "", //收款状态
        vinCode: "", //车架号
        contNo: "", //采购合同
        saleContNo: "", //销售合同
        procurementCost: "", //采购成本
        salePrice: "", //车辆售价
        entryId: "", //分录Id
        proviceName: "", //信息提供人
        proviceId: "", //信息提供人
        assessName: "", //评估人
        assessId: "", //评估人
        capInterest: "", //资金利息
        costTotal: "", //整车费用合计
        costSheetSparay: "", //版喷整备
        costEMRepair: "", //机电修复
        costOther: "", //其他整备费用
        costInspection: "", //检测费
        costCerExtension: "", //认证延保
        costClean: "", //美容清洗
        costPrepareAmt: "", //整备工单费用
        otherTotal: "", //其他合计
        otherCommission: "", //佣金
        otherTax: "", //税费
        otherTracel: "", //差旅费
        otherTransfer: "", //过户费
        otherOil: "", //加油费
        otherBoardCar: "", //板车费
        brandId: "", //品牌ID
        brandName: "", //品牌名称
        shwoOrgName: "", //展厅名字
        showOrgId: "" //展厅ID
      },
      uploader: [],
      columns: [],
      showSelectPicker: false,
      disabled: false,
      detailId: "",
      tabActive: 0,
      recordList: [
        {
          id: 1,
          name: "闽D66666定期保养招揽",
          status: 2,
          insure: 2,
          time: "2023-06-25 12:29:30",
          address: "福建省厦门市思明区",
          vin: "LKHHAHHHAHHHHAYYYYA",
          tel: "13333333333",
          userName: "张某某",
          servieName: "高某某",
          carType: " CT5 2,0T",
          mileage: "9999"
        },
        {
          id: 2,
          name: "闽D66666",
          status: 2,
          insure: 2,
          time: "2023-06-25 12:29:30",
          address: "福建省厦门市思明区",
          vin: "LKHHAHHHAHHHHAYYYYA",
          tel: "16666666666",
          userName: "张某某",
          servieName: "高某某",
          carType: " CT5 2,0T",
          mileage: "9999"
        }
      ],

      userId: getCookies("userId") //用户ID，必填，String
    };
  },

  mounted() {
    if (this.$route.query) {
      this.detailId = this.$route.query.billId;
      this.getDetail(this.detailId);
    }
  },
  methods: {
    getDetail(billId) {
      sellManageApi
        .secondHandCarFacade({
          billId,
          method: "getUsedCarAttachedById"
        })
        .then(res => {
          if (res.code == 1) {
            this.dataSource = res.data;
          }
        });
    },
    editApply(status) {
      if (status == "审核") {
        return;
      }
      this.$router.push({
        path: "/attachedEdit",
        query: { billId: this.dataSource.billId }
      });
    }
  }
};
</script>

<style lang="less" scoped>
body {
  background: #f3f3f3;
}
.flex {
  display: flex;
  align-items: center;
}
.registerDetail {
  padding-bottom: 70px;
  .top_detail {
    display: flex;
    align-items: center;
    // width: 100%;
    background: #fff;
    padding: 10px;
    margin: 10px;
    .top_detail_lt {
      display: inline-block;
      text-align: center;
      width: 50%;
      border-right: 1px solid #f0f0f0;
    }
    .top_detail_rt {
      width: 50%;
      display: inline-block;
      text-align: center;
    }
    .top_name {
      font-weight: bold;
      font-size: 13px;
      margin-bottom: 5px;
    }
    .top_status {
      color: red;
      font-size: 12px;
      margin-bottom: 5px;
    }
    .top_txt {
      font-size: 12px;
      color: #333;
      margin-bottom: 5px;
      .icon-tel {
        background: #35bc04;
        color: #fff;
        border-radius: 50%;
        padding: 5px;
      }
    }
  }
}

// 跟进信息
.followInfo {
  padding: 10px;
  background: #fff;

  .foll_title {
    box-sizing: border-box;
    color: #646566;
    text-align: left;
    font-size: 15px;
    padding: 5px 10px 5px 5px;
    margin-bottom: 10px;
  }
  .followInfo_item {
    margin-bottom: 10px;
    position: relative;
    .followInfo_lt {
      width: 20%;
      .followInfo_time {
        font-size: 14px;
        color: #666;
        position: absolute;
        top: 5px;
      }
      &::before {
        content: "";
        height: 130px;
        width: 1px;
        background: #ccc;
        position: absolute;
        top: 0px;
        left: 20px;
      }
      .icon-circle {
        color: #ccc;
        z-index: 2;
        position: absolute;
        top: 0px;
        left: 11px;
        background: #fff;
      }
    }
    .followInfo_rt {
      background: #f1f1f1;
      width: 80%;
      padding: 15px 0 15px 15px;
      border-radius: 4px;
      .followInfo_tt {
        display: flex;
        align-items: center;
        border: 1px solid #02c081;
        font-size: 12px;
        border-radius: 3px;
        margin-bottom: 5px;
        width: 200px;

        .followInfo_status {
          background: #02c081;
          color: #fff;
          padding: 5px;
        }
        .followInfo_time {
          padding: 5px;
          margin-left: 5px;
        }
      }
      .followInfo_num {
        font-size: 14px;
        color: #333;
        margin-bottom: 5px;
      }
      .followInfo_data {
        font-size: 13px;
        color: #666;
        margin-bottom: 5px;
        .followInfo_img {
          width: 40px;
          height: 40px;
          margin-right: 5px;
        }
      }
    }
  }
}
.morebox {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 99;
  width: 100%;
  background: #fff;
  .moreBtn {
    background: #409eff;
    color: #fff;
    width: 75%;
    margin: auto;
    text-align: center;
    padding: 12px;
    border-radius: 5px;
    margin-top: 15px;
    font-size: 15px;
    margin-bottom: 25px;
  }
}
.tableData {
  width: 100%;
  margin: auto;
  border-collapse: collapse;
  text-align: center;
  table {
    width: 100%;
    font-size: 12px;
  }
  .tab_item {
    background: #f1f1f1;
  }
  tr {
    th {
      font-size: 12px;
      border: 1px solid #ccc;
      padding: 10px 0;
      background: #409eff;
      color: #fff;
    }
    td {
      padding: 5px 0;
      border: 1px solid #ccc;
      font-size: 12px;
    }
  }
}
.footerBtn {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #fff;
  padding-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);

  .submitBtn {
    width: 80%;
    margin: auto;
    margin-top: 15px;
    justify-content: space-between;
    overflow: hidden;
    box-sizing: content-box;

    .btnbox {
      width: 100%;
      font-size: 14px;
      padding: 12px 0;
      border-radius: 5px;
      text-align: center;
      color: #fff;
      box-sizing: content-box;
    }
    .editBtn {
      background: #409eff;
    }
    .cancelBtn {
      background: #e31010;
    }
  }
}
</style>
